import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/iview.js'
import './assets/css/global.css'
import axios from 'axios'
import Qs from 'qs'

//生产阶段接口
axios.defaults.baseURL = 'http://39.97.186.156:8082'

//开发阶段接口
// axios.defaults.baseURL = 'http://localhost:8082'

axios.defaults.withCredentials = true
Vue.prototype.$http = axios
Vue.prototype.$qs = Qs
Vue.config.productionTip = false

axios.interceptors.response.use(config => {
  if(config.data.errorCode === 2009){
    window.sessionStorage.clear()
    window.alert('账号已被强制下线');
    window.location.replace('/login')
  }
  return config
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
